window.onload = function () {
    var end = false;
    // 版本号 xxxxxxxxxx
    var version = "1.28";
    localStorage.setItem("version", version);
    setTimeout(function () {
        console.log("ajaxUrl", localStorage.getItem("ajaxUrl"))
        var ajaxUrl = localStorage.getItem("ajaxUrl");
        if (!end && ajaxUrl.includes('4000')) {
            getVersion()
        }
    }, 500);

    function getVersion() {
        $.ajax({
            type: "POST",
            url: "https://222.223.234.231:4000/app/getVersion",
            dataType: "json",
            success: function (res) {
                if (res.success) {
                    var data = res.result;
                    end = true;
                    if (version < data.version) {
                        $.alert('版本升级', function () {
                            window.open(data.href, "_system", "location=yes");
                        });
                    }
                }
            },
            error: function (error) {
                console.log(error);
            }
        });
    }


};

